
{{ include("common/header.html")}}
<div class="admin">
    {{ include("common/settingNav.html")}}
    <link rel="stylesheet" href="{{_G['APP']}}/resource/wangEditor/css/wangEditor.min.css">
    <script type="text/javascript" src="{{_G['APP']}}/resource/js/jquery.min.js"></script>
    <script type="text/javascript" src="{{_G['APP']}}/resource/wangEditor/js/wangEditor.min.js"></script>

    <div class="aright" >
        <style type="text/css">
            .tpt_sels a{padding-right:15px;position:relative}
            .tpt_sels a{padding:0 20px 0 8px;color:#3B6268;background:#FFFFBA;border:1px #F8E06E solid;margin-right:5px;margin-bottom:5px;font-size:14px;height:26px;line-height:26px;display:block;float:left}
            .tpt_sels a em{width: 12px;height: 12px;font-style: normal;display: block;position: absolute;top: 7px;right: 4px;z-index: 2;background: url(/blog/Public/img/sx.png) no-repeat 0 0;}
        </style>
        <div class="layui-tab" lay-filter="demo" style="margin: 20px 30px 20px 20px;">
            <ul class="layui-tab-title">
                <li class=" {% if _GPC['t']=='configure' %} layui-this {%endif%}">基础设置</li>
                <li class=" {% if _GPC['t']=='route' %} layui-this {%endif%}">系统设置</li>
                <li class=" {% if _GPC['t']=='email' %} layui-this {%endif%}">邮件设置</li>
                <li class=" {% if _GPC['t']=='sms' %} layui-this {%endif%}">短信设置</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item  {% if _GPC['t']=='configure' %} layui-show {%endif%}">

                    <form class="layui-form bform" method="post" action="{{G.url('admin/setting/saveconfigure')}}" enctype="multipart/form-data">

                        <div class="layui-form-item">
                            <label class="layui-form-label">网站标题</label>
                            <div class="layui-input-block">
                                <input type="text" name="TITLE" value="{{calfbbs.TITLE}}" placeholder="必填内容" required="" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">关键字</label>
                            <div class="layui-input-block">
                                <textarea name="KEYWORDS" placeholder="请输入内容" class="layui-textarea">{{calfbbs.KEYWORDS}}</textarea>
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">网站描述</label>
                            <div class="layui-input-block">
                                <textarea name="DESCRIPTION" placeholder="请输入内容" class="layui-textarea">{{calfbbs.DESCRIPTION}}</textarea>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">备案号</label>
                            <div class="layui-input-block">
                                <input type="text" name="ICP" value="{{calfbbs.ICP}}" placeholder="请输入内容" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">版权声明</label>
                            <div class="layui-input-block">
                                <input type="text" name="COPYRIGHT" value="{{calfbbs.COPYRIGHT}}" placeholder="请输入内容" autocomplete="off" class="layui-input">
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <label class="layui-form-label">广告LOGO</label>
                            <div class="layui-input-block">
                                <div class="file-box">

                                    <button type="button" class="layui-btn" id="upload">
                                        上传图片
                                    </button>&nbsp;&nbsp;图片尺寸160X50
                                    <input type="hidden" name="LOGO" value="{{calfbbs.LOGO}}"/>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label"></label>
                            <div class="layui-input-block">
                                <img width="115" id="LOGO" height="40" src="{{_G['ATTACHMENT_ROOT']}}/{{calfbbs.LOGO}}" alt=""/>


                            </div>
                        </div>



                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="formDemo">立即提交</button>
                              <!--  <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>-->
                            </div>
                        </div>

                    </form>

                </div>
                <div class="layui-tab-item {% if _GPC['t']=='route' %} layui-show {%endif%}">


                    <form class="layui-form bform" method="post" action="{{G.url('admin/setting/saveRoute')}}" enctype="multipart/form-data">
                        <div class="layui-form-item">
                            <label class="layui-form-label">启用模版</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="TPL_STATUS"  lay-filter="TPL_STATUS" lay-skin="switch" lay-text="开启|关闭"  {% if route.TPL_APP.TPL_STATUS==true %} checked {%endif%}>
                            </div>
                        </div>
                        <div id="TPL_DEFAULT" class="layui-form-item {% if route.TPL_APP.TPL_STATUS==true %}  layui-show {% else %}  layui-hide {%endif%} ">
                            <label class="layui-form-label">模板名称</label>
                            <div class="layui-input-block">
                                <select name="TPL_DEFAULT" >
                                    <option value=" ">系统默认</option>
                                    {% for v in tplList %}
                                    <option value="{{v}}" {% if route.TPL_APP.TPL_DEFAULT==v %} selected {%endif%}>{{v}}</option>
                                    {% endfor %}


                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">伪静态后缀</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="SUFFIX_STATUS" lay-filter="SUFFIX_STATUS" lay-skin="switch" lay-text="开启|关闭"  {% if route.SUFFIX_STATUS==true %} checked {%endif%}>
                            </div>开启后将自动在url末尾加上后缀，如：http://test.calfbbs.com/detail-1.html
                        </div>

                        <div id="SUFFIX_STATUS" class="layui-form-item  {% if route.SUFFIX_STATUS==false %} layui-hide {%endif%}">
                            <label class="layui-form-label">后缀名</label>
                            <div class="layui-input-block">
                                <input type="text" name="SUFFIX" value="{{route.SUFFIX}}" placeholder="请输入内容" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">隐藏url中的index.php</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="IDENX_SUFFIX" lay-skin="switch" lay-text="开启|关闭"  {% if route.IDENX_SUFFIX==true %} checked {%endif%}>
                            </div><br />用于支持伪静态,网站不可配置在二级目录中 如http://test.calfbb.com/calfbb/index.php
                        </div>


                        <!--<div class="layui-form-item">
                            <label class="layui-form-label">路由模式</label>
                            <div class="layui-input-block">
                                <input type="radio" name="PATH_INFO" value="1" title="普通模式" {% if route.PATH_INFO==1 %} checked {%endif%}><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon"></i><span>普通模式</span></div>

                                <input type="radio" name="PATH_INFO" value="2" title="伪静态模式"  {% if route.PATH_INFO==2 %} checked {%endif%}><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i><span>伪静态模式</span></div>

                                <input type="radio" name="PATH_INFO" value="3" title="兼容模式"  {% if route.PATH_INFO==3 %} checked {%endif%}><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i><span>兼容模式</span></div>
                            </div>
                        </div>-->

                        <!--<blockquote style="padding: 10px;border-left: 5px solid #FF5722;margin: 10px 0 20px 40px;" class="layui-elem-quote">想了解路由模式的区别：<a href="https://www.kancloud.cn/calfbaby/calfbb/422590" style="color:#FF5722;" target="_blank">路由文档</a></blockquote>-->

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="formDemo">立即提交</button>
                               <!-- <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>-->
                            </div>
                        </div>

                    </form>


                </div>
                {{ include("setting/email.html")}}
                {{ include("setting/sms.html")}}
            </div>
        </div>


    </div>
</div>

<script>

    layui.use(['form','upload'], function(){
        var upload = layui.upload;
        /**
         * 图片上传
         */
        var uploadInst = upload.render({
            elem: '#upload' //绑定元素
            ,url: escapeUrl("{{ G.url('admin/files/uploadFile')}}") //上传接口
            ,method:"post"
            ,data:{width:160}
            ,done: function(res){
                if(res.code==1001 && res.data){
                    $('#LOGO').attr('src',"{{_G['ATTACHMENT_ROOT']}}/"+res.data);
                    $('input[name=LOGO]').val(res.data);
                }
            }
            ,error: function(res){

            }
        });
    });


</script>
<script>

    layui.use('form', function(){
        var form = layui.form;
        //监听启用模版
        form.on("switch(TPL_STATUS)", function(data){

            if(data.elem.checked==true){
                $('#TPL_DEFAULT').attr("class","layui-form-item layui-show");
            }else{
                $('#TPL_DEFAULT').attr("class","layui-form-item layui-hide");
            }

        });


        //监听启用模版
        form.on("switch(SUFFIX_STATUS)", function(data){

            if(data.elem.checked==true){
                $('#SUFFIX_STATUS').attr("class","layui-form-item layui-show");
            }else{
                $('#SUFFIX_STATUS').attr("class","layui-form-item layui-hide");
            }

        });

        $("#submitRoute").click(function(){
            layer.confirm('修改系统参数，有可能会导致系统不可用,您确定要修改吗？', {
                btn: ['确定','取消'] //按钮
            }, function(){
                $('#routeSubmit').click();
            }, function(){

            });

        })

        //监听启用模版
        /*form.on("submit(route)", function(data){
            //询问框

            layer.confirm('修改系统参数，有可能会导致系统不可用,您确定要修改吗？', {
                btn: ['确定','取消'] //按钮
            }, function(){
                return true;
            }, function(){
                return false;
            });
            return false;


        });*/


    });

</script>
</body>
</html>